<?php
	require_once( '../../_config/base.inc.php' );
	
	use \dayscript\ErrorManager;
	use \dayscript\Enviroment;
	use \dayscript\xml\rpc\Server;
	use \dayscript\util\Benchmark;
	use \dayscript\log\LogManager;
	
	\dayscript\Application::getInstance( BASE_DIR . '_config/tests.inc.php' );
	ErrorManager::setUproarMode( true ); // Not for production

	class SimpleServer extends Server	{
		public function SimpleServer( $data )	{
			parent::__construct( array (
				'dayrpc.helloDolly' => 'this:helloDolly',
				'dayrpc.addTwoNumbers' => 'this:addTwoNumbers'
				)
				, $data
			);
		}
		public function helloDolly( $args )	{
			return 'Hello Dolly!';
		}
		function addTwoNumbers( $args )	{
			$number1 = $args[0];
			$number2 = $args[1];
			return $number1 + $number2;
		}
	}

	// Avoid direct output log
	if( Enviroment::http_raw_post_data( ) )
		LogManager::removeLogger( 'output' );
	
	$server = new SimpleServer( Enviroment::http_raw_post_data( ) );

